﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace loan_process
{
    public class LoanData
    {
        public DateTime date { set; get; }
        public string narration { set; get; }
        public DateTime fromDate { set; get; }
        public DateTime toDate { set; get; }
        public double credit { set; get; }
        public double debit { set; get; }
        public double balance { set; get; }

        public LoanData()
        {
            date = DateTime.MinValue;            
            narration = null;
            fromDate = DateTime.MinValue;
            toDate = DateTime.MinValue;
            credit = 0.0d;
            debit = 0.0d;
            balance = 0.0d;

        }

        public double difference()
        {
            TimeSpan timeSpan = toDate-fromDate;
            return timeSpan.TotalDays;
        }

        public override string ToString()
        {
            return date.ToString("MM/dd/yyyy") + "|" + narration + "|" + fromDate.ToString("MM/dd/yyyy") + "|" + toDate.ToString("MM/dd/yyyy") + "|" + credit + "|" + debit + "|" + balance;
        }
    }
}
